using UnityEngine;

public class Wall : MonoBehaviour
{
	private void OnTriggerEnter2D(Collider2D col)
	{
		if (col.CompareTag(Values.Instance.CollectibleTag))
		{
			if (col.attachedRigidbody.velocity != Vector2.zero)
			{
				col.attachedRigidbody.velocity *= -1f;
			}
			else
			{
				col.attachedRigidbody.velocity = Random.insideUnitCircle * 2f;
			}
		}
	}

	private void OnTriggerStay2D(Collider2D col)
	{
		if (col.CompareTag(Values.Instance.CollectibleTag))
		{
			col.GetComponent<Collectible>().FinalizeCollectible();
		}
	}
}
